#ifndef PLAYER_H
#define PLAYER_H

#include <map>
#include <string>
#include "types.h"
#include "RakPeerInterface.h"
#include "npc.h"

class Npc;

class Player
{
    private:
        static std::map<RakNet::RakNetGUID, Player*> Players;
        RakNet::RakNetGUID guid;
        std::string name;

        position pos;
        position flag;
        float velX, velY;
        int movementSpeed;

        Npc *combatNpc;

        void calculate_vel();
        void stop();

    public:
        Player(RakNet::RakNetGUID guid, std::string name, int x, int y);
        ~Player();

        static Player* GetPlayerFromGUID(RakNet::RakNetGUID guid);
        static std::map<RakNet::RakNetGUID, Player*> GetPlayerList();

        int hp, mp;
        int maxhp, maxmp;

        void work(unsigned long deltaTicks);
        void move(unsigned long deltaTicks);
        void create_flag(int x, int y);
        void attack(Npc* npc);

        RakNet::RakNetGUID get_guid();
        std::string get_name();
        int x();
        int y();

        void set_x(int x);
        void set_y(int y);
};

#endif // PLAYER_H
